package com.liferay.model;


public class Contact {
	private long contactID;
	private String fullName;
	private String email;
	private String phone;
	private String title;
	private String question;
	private String dateCreate;
	private int isRead;

	public Contact(String fullName, String email, String phone, String title,
			String question, String dateCreate, int isRead) {
		this.fullName = fullName;
		this.email = email;
		this.phone = phone;
		this.title = title;
		this.question = question;
		this.dateCreate = dateCreate;
		this.isRead=isRead;
	}

	public int getIsRead() {
		return isRead;
	}

	public void setIsRead(int isRead) {
		this.isRead = isRead;
	}

	public Contact() {

	}

	public String getDateCreate() {
		return dateCreate;
	}

	public void setDateCreate(String dateCreate) {
		this.dateCreate = dateCreate;
	}

	public String getFullName() {
		return fullName;
	}

	public void setFullName(String fullName) {
		this.fullName = fullName;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getQuestion() {
		return question;
	}

	public void setQuestion(String question) {
		this.question = question;
	}

	// check Name
	public boolean checkName() {
		if (!fullName.equals("") && fullName != null)
			return true;
		return false;
	}

	// check y kien
	public boolean checkNoiDungYKien() {
		if (!question.equals("") && question != null)
			return true;
		return false;
	}

	// check topic
	public boolean checkChuDe() {
		if (!title.equals("") && title != null)
			return true;
		return false;
	}

	// checkPhone
	public boolean checkPhoneNotNull() {
		if (!phone.equals("") && phone != null)
			return true;
		return false;
	}

	public boolean checkPhone() {

		char[] arr = this.phone.toCharArray();
		for (int i = 0; i < arr.length; i++) {
			if (Character.isLetter(arr[i]))
				return false;
		}
		return true;

	}

	// check email
	public boolean checkEmail() {
		if (!email.equals("") && email != null) {
			int aCong = email.indexOf("@");
			int dauCham = email.lastIndexOf(".");

			if ((aCong < 1) || (dauCham < aCong + 2)
					|| (dauCham + 2 > email.length())) {
				return false;
			}
			return true;
		}
		return false;
	}

	public boolean checkEmailNotNull() {
		if (!email.equals("") && email != null)
			return true;
		return false;
	}
	public long getContactID() {
		return contactID;
	}

	public void setContactID(long contactID) {
		this.contactID = contactID;
	}
}
